﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Crank.Core
{
    static class Blackboard
    {
        private static IDictionary<string, object> values;

        static Blackboard()
        {
            values = new Dictionary<string, object>();
        }


        public static IProperty<T> Create<T>(string name)
        {
            if (!values.ContainsKey(name))
                values.Add(name, new BlackboardProperty<T>());
            return values[name] as IProperty<T>;
        }

        private class BlackboardProperty<T> : IProperty<T>
        {
            #region IProperty<T> Members

            public T Value
            {
                get;
                set;
            }

            #endregion
        }
    }
}
